<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
            list-style: none;
        }

        .pager {
            display: flex
        }

        .pager li {
            width: 30px;
            height: 30px;
            border: 1px saddlebrown solid;
            text-align: center;
            line-height: 30px;
            color: saddlebrown;
            margin: 2px;
            cursor: pointer;
            border-radius: 3px;
        }

        .pager li.active {
            background: saddlebrown;
            color: #fff;
        }

        .pager li:hover {
            background: saddlebrown;
            color: #fff;
        }
    </style>
</head>

<body>
    <div id="app">
        <Simba :count="5" :pageIndex="1" style="margin:100px"></Simba>
        <Simba :count="10" :pageIndex="5" style="margin:100px"></Simba>
        <Simba :count="10" :pageIndex="10" style="margin:100px"></Simba>
    </div>
    <script src="https://cdn.bootcss.com/vue/2.6.4/vue.js"></script>
    <script>
        Vue.config.productionTip = false
        Vue.config.devtools = false

        var Simba = Vue.extend({
            props: ["count", "pageindex"],
            render(h) {
                var children = []

                children.push(h('li', {
                    "class": {
                        active: 1 === this.pageindex
                    }
                }, 1))

                if (this.count > 5) {
                    children.push(h('li', '...'))
                }

                for (let i = 2; i < this.count; i++) {
                    children.push(h('li', {
                        "class": {
                            active: i === this.pageindex,
                        },
                        style: {
                            display: i >= this.pageindex ? "block" : "none"
                        }
                    }, i))
                }
                if (this.count > 5) {
                    children.push(h('li', '...'))
                }
                children.push(h('li', {
                    "class": {
                        active: this.count === this.pageindex
                    }
                }, this.count))



                // if (this.count > 5 && this.pageindex < 8  ) {
                //     children.push(h('li', '...'))
                // }
                // children.push(h('li', this.count))
                return h("ul", {
                    'class': ["pager"]
                }, children)
            },
        })

        new Vue({
            el: "#app",
            components: {
                Simba
            }
        })
    </script>
</body>

</html>